/* GUI CONVERTED from rescrp02.p (converter v1.75) Wed Nov  8 12:55:34 2000 */
/* rescrp02.p - REPETITIVE                                                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=FullGUIReport                                       */
/* REVISION: 7.3               LAST MODIFIED: 10/31/94   BY: WUG *GN77*       */
/* REVISION: 8.6               LAST MODIFIED: 10/11/97   BY: bvm *K0S9*       */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb                  */
/* REVISION: 9.1      LAST MODIFIED: 09/11/00 BY: *N0RS* Mudit Mehta          */

/* SCRAP VALUATION REPORT                                                     */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K0S9*/ {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rescrp02_p_2 "Effective"
/* MaxLen: Comment: */

&SCOPED-DEFINE rescrp02_p_4 "Cost Set To Use"
/* MaxLen: Comment: */

&SCOPED-DEFINE rescrp02_p_8 "Report Cost Elements"
/* MaxLen: Comment: */

&SCOPED-DEFINE rescrp02_p_9 "Sort Option"
/* MaxLen: Comment: */

/*N0RS***********BEGIN COMMENTING*************
 * &SCOPED-DEFINE rescrp02_p_1 "1 - By Site, Item, Operation, Line"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp02_p_3 "1 - Cum Order Standard"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp02_p_5 "2 - By Extended Cost Descending"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp02_p_6 "2 - Cum Order Average"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp02_p_7 "3 - G/L Cost"
 * /* MaxLen: Comment: */
 *N0RS***********END COMMENTING************* */

/* ********** End Translatable Strings Definitions ********* */

/*K0S9*/ define new shared variable dept  like wc_dept.
/*K0S9*/ define new shared variable dept1 like wc_dept label {t001.i}.
/*K0S9*/ define new shared variable effdate  as date label {&rescrp02_p_2}.
/*K0S9*/ define new shared variable effdate1 as date label {t001.i}.
/*K0S9*/ define new shared variable emp  like op_emp.
/*K0S9*/ define new shared variable emp1 like op_emp label {t001.i}.
/*K0S9*/ define new shared variable line  like wo_line.
/*K0S9*/ define new shared variable line1 like wo_line label {t001.i}.
/*K0S9*/ define new shared variable lot  like wo_lot.
/*K0S9*/ define new shared variable lot1 like wo_lot label {t001.i}.
/*K0S9*/ define new shared variable mch  like wc_mch.
/*K0S9*/ define new shared variable mch1 like wc_mch label {t001.i}.
/*K0S9*/ define new shared variable part  like wo_part.
/*K0S9*/ define new shared variable part1 like wo_part label {t001.i}.
/*K0S9*/ define new shared variable reason  like op_rsn.
/*K0S9*/ define new shared variable reason1 like op_rsn label {t001.i}.
/*K0S9*/ define new shared variable shift  like op_shift.
/*K0S9*/ define new shared variable shift1 like op_shift label {t001.i}.
/*K0S9*/ define new shared variable site  like wo_site.
/*K0S9*/ define new shared variable site1 like wo_site label {t001.i}.
/*K0S9*/ define new shared variable wkctr  like wc_wkctr.
/*K0S9*/ define new shared variable wkctr1 like wc_wkctr label {t001.i}.
/*K0S9*/ define new shared variable cost_set_to_use as character
            format "x" label {&rescrp02_p_4}.
/*K0S9*/ define new shared variable report_cost_elements like mfc_logical
         label {&rescrp02_p_8}.
/*K0S9*/ define variable sortoption as integer label {&rescrp02_p_9} format "9"
     initial 1.
/*N0RS*/ define variable disp-cum-order-standard as character no-undo
            format "x(34)".
/*N0RS*/ define variable disp-cum-order-average  as character no-undo
            format "x(34)".
/*N0RS*/ define variable disp-gl-cost            as character no-undo
            format "x(24)".
/*N0RS*/ define variable disp-by-site-item       as character no-undo
            format "x(34)".
/*N0RS*/ define variable disp-by-extended        as character no-undo
            format "x(34)".

/*N0RS*/ disp-cum-order-standard = "1 - " +
                                   getTermLabel("CUM_ORDER_STANDARD",30).
/*N0RS*/ disp-cum-order-average  = "2 - " +
                                   getTermLabel("CUM_ORDER_AVERAGE",30).
/*N0RS*/ disp-gl-cost            = "3 - " +
                                   getTermLabel("GL_COST",20).
/*N0RS*/ disp-by-site-item       = "1 - " +
                                   getTermLabel("BY",2) + " " +
                                   getTermLabel("SITE",4) + ", " +
                                   getTermLabel("ITEM",4) + ", " +
                                   getTermLabel("OPERATION",9) + ", " +
                                   getTermLabel("LINE",4).
/*N0RS*/ disp-by-extended        = "2 - " +
                                   getTermLabel("BY_EXTENDED_COST_DESCENDING",30).


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
lot                      colon 20
   lot1                     colon 45
   part                     colon 20
   part1                    colon 45
   site                     colon 20
   site1                    colon 45
   line                 colon 20
   line1                colon 45
   reason               colon 20
   reason1              colon 45
   wkctr                colon 20
   wkctr1               colon 45
   mch                  colon 20
   mch1                 colon 45
   dept                 colon 20
   dept1                colon 45
   shift                colon 20
   shift1               colon 45
   emp                  colon 20
   emp1                 colon 45
   effdate              colon 20
   effdate1             colon 45
   cost_set_to_use          colon 35
/*N0RS*
 *  {&rescrp02_p_3}         at 40
 *  {&rescrp02_p_6}      at 40
 *  {&rescrp02_p_7}           at 40
 *  sortoption                   colon 35
 *  {&rescrp02_p_1} at 40
 *  {&rescrp02_p_5}    at 40
 *N0RS*/
/*N0RS*/  disp-cum-order-standard  at 40 no-label
/*N0RS*/  disp-cum-order-average   at 40 no-label
/*N0RS*/  disp-gl-cost             at 40 no-label
/*N0RS*/  sortoption               colon 35
/*N0RS*/  disp-by-site-item        at 40 no-label
/*N0RS*/  disp-by-extended         at 40 no-label
   report_cost_elements         colon 35
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/*K0S9* {mfdtitle.i "b+ "} **/

cost_set_to_use = "1".

/*K0S9*/ {wbrp01.i}


/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if lot1 = hi_char then lot1 = "".
   if part1 = hi_char then part1 = "".
   if site1 = hi_char then site1 = "".
   if line1 = hi_char then line1 = "".
   if reason1 = hi_char then reason1 = "".
   if wkctr1 = hi_char then wkctr1 = "".
   if mch1 = hi_char then mch1 = "".
   if dept1 = hi_char then dept1 = "".
   if shift1 = hi_char then shift1 = "".
   if emp1 = hi_char then emp1 = "".
   if effdate = low_date then effdate = ?.
   if effdate1 = hi_date then effdate1 = ?.

/*N0RS*/ if c-application-mode <> 'web' then
/*N0RS*/ display disp-cum-order-standard disp-cum-order-average
         disp-gl-cost disp-by-site-item disp-by-extended with frame a.

/*K0S9*/ if c-application-mode <> 'web' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K0S9*/ {wbrp06.i &command = update
                   &fields = "  lot lot1 part part1 site site1 line line1
                    reason reason1 wkctr wkctr1 mch mch1 dept dept1 shift shift1
                    emp emp1 effdate effdate1 cost_set_to_use sortoption
                    report_cost_elements"
                   &frm = "a"}

/*K0S9*/ if (c-application-mode <> 'web') or
/*K0S9*/ (c-application-mode = 'web' and
/*K0S9*/ (c-web-request begins 'data')) then do:

   bcdparm = "".
   {mfquoter.i lot}
   {mfquoter.i lot1}
   {mfquoter.i part}
   {mfquoter.i part1}
   {mfquoter.i site}
   {mfquoter.i site1}
   {mfquoter.i line}
   {mfquoter.i line1}
   {mfquoter.i reason}
   {mfquoter.i reason1}
   {mfquoter.i wkctr}
   {mfquoter.i wkctr1}
   {mfquoter.i mch}
   {mfquoter.i mch1}
   {mfquoter.i dept}
   {mfquoter.i dept1}
   {mfquoter.i shift}
   {mfquoter.i shift1}
   {mfquoter.i emp}
   {mfquoter.i emp1}
   {mfquoter.i effdate}
   {mfquoter.i effdate1}
   {mfquoter.i cost_set_to_use}
   {mfquoter.i sortoption}
   {mfquoter.i report_cost_elements}

   if lot1 = "" then lot1 = hi_char.
   if part1 = "" then part1 = hi_char.
   if site1 = "" then site1 = hi_char.
   if line1 = "" then line1 = hi_char.
   if reason1 = "" then reason1 = hi_char.
   if wkctr1 = "" then wkctr1 = hi_char.
   if mch1 = "" then mch1 = hi_char.
   if dept1 = "" then dept1 = hi_char.
   if shift1 = "" then shift1 = hi_char.
   if emp1 = "" then emp1 = hi_char.
   if effdate = ? then effdate = low_date.
   if effdate1 = ? then effdate1 = hi_date.

/*K0S9*/ end.

   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   if sortoption = 1 then do:
      {gprun.i ""rescrp2a.p""}
   end.
   else do:
      {gprun.i ""rescrp2b.p""}
   end.

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

end.

/*K0S9*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" lot lot1 part part1 site site1 line line1 reason reason1 wkctr wkctr1 mch mch1 dept dept1 shift shift1 emp emp1 effdate effdate1 cost_set_to_use sortoption report_cost_elements "} /*Drive the Report*/
